import request from '@/config/axios'

export interface OwnMeterConfigVo {
  id: number
  memberUserId: number
  memberUserName: string
  minPayElecCharge: number
  payFeeStyle: number
  matCode: string
  warnElecMoney: number
  matExpiresTime: Date
  lastOperIp: string
  lastOperDate: Date
}

// 创建房东电表充值配置
export const createOwnMeterConfig = async (data: OwnMeterConfigVo) => {
  return await request.post({
    url: '/zwsj/own-meter-config/create',
    data: data
  })
}

// 更新房东电表充值配置
export const updateOwnMeterConfig = async (data: OwnMeterConfigVo) => {
  return await request.put({
    url: '/zwsj/own-meter-config/update',
    data: data
  })
}

// 更新房东电表充值配置
//{configId: number}
export const registerUnionAccount = async (id: number) => {
  return await request.get({
    url: '/zwsj/own-meter-config/register/union/account?configId=' + id
  })
}

// 删除房东电表充值配置
export const deleteOwnMeterConfig = async (id: number) => {
  return await request.delete({
    url: '/zwsj/own-meter-config/delete?id=' + id
  })
}

// 获得房东电表充值配置
export const getOwnMeterConfig = async (id: number) => {
  return await request.get({
    url: '/zwsj/own-meter-config/get?id=' + id
  })
}

// 获得房东电表充值配置分页
export const getOwnMeterConfigPage = async (params: any) => {
  return await request.get({
    url: '/zwsj/own-meter-config/page',
    params: params
  })
}

// 导出房东电表充值配置 Excel
export const exportOwnMeterConfigExcel = async (params: any) => {
  return await request.get({
    url: '/zwsj/own-meter-config/export-excel',
    params: params,
    responseType: 'blob'
  })
}
